package org.example.seata.common.rabbitmq.config;

import org.example.seata.common.rabbitmq.constant.ExchangeQueueRoutingKey;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.ExchangeBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hzq
 * @date 2021/11/29 17:31
 */
@Configuration
public class RabbitExchangeConfiguration {

    /**
     * @return 订单延时交换器
     */
    @Bean
    public DirectExchange orderDelayDirectExchange() {
        return ExchangeBuilder.directExchange(ExchangeQueueRoutingKey.ORDER_DELAY_DIRECT_EXCHANGE).build();
    }

    /**
     * @return 订单交换器
     */
    @Bean
    public DirectExchange orderDirectExchange() {
        return ExchangeBuilder.directExchange(ExchangeQueueRoutingKey.ORDER_DIRECT_EXCHANGE).build();
    }
}
